﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;
using r4u.business.logic.layer.REGISTER;

namespace r4u.Controllers
{
    public class ResetController : Controller
    {
        //
        // GET: /Reset/

        public ActionResult Index(int id)
        {
            User temp = new User();
            string email = temp.GetEmailBySecurityCode(id.ToString());

            ViewBag.email = email;
            return View();
        }


        [HttpPost]
        public ActionResult NewPassword(User user)
        {
            User temp = new User();

            if (temp.ResetPassword(user.email, user.password))
            {
                return new HttpStatusCodeResult(HttpStatusCode.OK);
            }
            else
            {
                return new HttpStatusCodeResult(HttpStatusCode.InternalServerError);
            }
        }

    }
}
